package com.dhecp.project.business.service.impl;

import com.dhecp.common.utils.IpUtils;
import com.dhecp.core.constant.DataFiltering;
import com.dhecp.core.utils.PageUtils;
import com.dhecp.project.business.domain.LogsticsPatternDetails;
import com.dhecp.project.business.mapper.LogsticsPatternDetailsMapper;
import com.dhecp.project.business.service.LogsticsPatternDetailsService;
import com.dhecp.project.common.service.impl.BaseModuleServiceImpl;
import com.dhecp.project.system.service.SysDictionaryForFieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 物流名称详情 服务层
 * @Author fxz
 * @Date 2022/12/07
 */
@Service
public class LogsticsPatternDetailsServicelmpl extends BaseModuleServiceImpl implements LogsticsPatternDetailsService {

    @Autowired
    private SysDictionaryForFieldService dictionaryForFieldService;

    @Autowired
    private LogsticsPatternDetailsMapper logsticsPatternDetailsMapper;


    /**
     * 查询物流名称
     * @param params
     * @return
     * @throws Exception
     */
    @Override
    public List<LogsticsPatternDetails> queryList(Map<String, Object> params) throws Exception {
        params.put(DataFiltering.TABLE_ALIAS, "t1");	//查询表别名
        params.put(DataFiltering.DATA_WHERE, dictionaryForFieldService.getWhereStr(params));	//常规查询条件SQL语句
        params.put(DataFiltering.DATA_SCODE, dictionaryForFieldService.getDataScode(params));	//数据权限查询条件SQL语句

        if (params.get("field") == null || params.get("field") == ""){
            String orderBy = "t1.createTime asc";
            PageUtils.startPageOrder(orderBy);
        }else{
            PageUtils.startPage();
        }

        return logsticsPatternDetailsMapper.findLogsticsPatternDetails(params);
    }
}
